package com.atguigu.day11.exer.e4;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/12 16:46
 * @注释 圆形的面积和周长
 */
public class Circle extends Graphic{
    private double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    /**
     * 圆的面积
     * @return
     */
    @Override
    public double area() {
        return Math.PI * radius * radius;
    }

    /**
     * 圆的周长
     * @return
     */
    @Override
    public double perimeter() {
        return 2 * Math.PI * radius;
    }

    /**
     * 返回圆的详细信息
     * @return
     */
    @Override
    public String toString() {
        return "圆的半径：" + radius + super.toString();
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }
}
